package com.atguigu.stgy.admin.service.impl;

import com.atguigu.stgy.admin.service.LabelInfoService;
import com.atguigu.stgy.model.enums.LabelTypeEnum;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
//

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atguigu.stgy.admin.mapper.LabelInfoMapper;
import com.atguigu.stgy.model.entity.LabelInfo;

import java.util.List;

@Service
public class LabelInfoServiceImpl extends ServiceImpl<LabelInfoMapper, LabelInfo> implements LabelInfoService {

    public List<LabelInfo> listLablesByType(LabelTypeEnum typeEnum) {
        LambdaQueryWrapper<LabelInfo> wrapper = Wrappers.lambdaQuery(LabelInfo.class);
        if(typeEnum!=null){
            wrapper.eq(LabelInfo::getType , typeEnum.getType());

        }
        return baseMapper.selectList(wrapper);
    }
}
